package com.zdgk.core.web.controller;

import com.zdgk.core.web.common.CommonResult;
import com.zdgk.core.web.entity.RuleInfo;
import com.zdgk.core.web.service.RuleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/rule")
public class RuleController {
    @Autowired
    private RuleService ruleService;

    @GetMapping("/all")
    public CommonResult<List<RuleInfo>> listAll() {
        return CommonResult.data(ruleService.getAllRules());
    }
    @PostMapping("/save/all")
    public CommonResult<?> saveAll(@RequestBody List<RuleInfo> ruleInfos) {
        ruleService.saveAll(ruleInfos);
        return CommonResult.ok();
    }

}
